import requestTypes from '../common';

// 获取字典列表
const getDicList = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictType/page',
		method: 'get',
		params: parameter,
	});
}
// 获取字典值列表
const getDicDataList = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictData/page',
		method: 'get',
		params: parameter,
	});
}

// 获取系统枚举类型
const getEnumTypeList = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysEnumData/enumTypeList',
		method: 'get',
		params: parameter,
	});
}
//  添加系统字典类型
const addHandle = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictType/add',
		method: 'post',
		data: parameter,
	});
}
// 编辑系统字典类型
const editHandle = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictType/edit',
		method: 'post',
		data: parameter,
	});
}
// 删除系统字典类型
const deleteHandle = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictType/delete',
		method: 'post',
		data: parameter,
	});
}

// 新增字典值
const addDicData = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictData/add',
		method: 'post',
		data: parameter,
	});
}
// 编辑字典值
const editDicData = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictData/edit',
		method: 'post',
		data: parameter,
	});
}
// 删除字典值
const deleteDicData = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictData/delete',
		method: 'post',
		data: parameter,
	});
}
// 获取字典类型下所有字典
const sysDictTypeDropDown = <T = any>(parameter: object = {}) => {
	return requestTypes<T>({
		url: '/sysDictType/dropDown',
		method: 'get',
		params: parameter,
	});
}

export default {
    getDicList,
	getEnumTypeList,
	addHandle,
	editHandle,
	deleteHandle,
	getDicDataList,
	addDicData,
	editDicData,
	deleteDicData,
	sysDictTypeDropDown,
}